package com.ruoyi.web.controller.system;

import com.github.pagehelper.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.News;
import com.ruoyi.system.service.INewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 缘赐堂官网接口 新闻中心
 */
@Api(value = "官网-新闻中心",tags = "官网-新闻中心",description = "官网-新闻中心")
@Controller
@RequestMapping("/yct/newsWeb")
public class NewsWebController extends BaseController {

	@Autowired
	private INewsService newsService;

	/**
	 * 新闻中心通过id查询
	 * @param id
	 * @return
	 */
	@ApiOperation(value = "新闻中心通过id查询",notes = "新闻中心通过id查询")
	@ResponseBody
	@GetMapping("/selectById")
	public AjaxResult selectById(Long id)
	{
		News news = newsService.selectNewsById(id);
		return AjaxResult.success(news);
	}

	/**
	 * 新闻中心通过id查询
	 * @return
	 */
	@ApiOperation(value = "新闻中心通过列表查询",notes = "新闻中心通过列表查询")
	@ResponseBody
	@GetMapping("selectList")
	public TableDataInfo list()
	{
		startPage();
		List<News> news1 = newsService.selectNewsList(null);
		return getDataTable(news1);
	}

}
